Skip to content

fix: route chat to the selected agent instead of always MicroClaw (#53)#54

Open
yikkuro wants to merge 1 commit into
mainfrom
yikkuro/fix-agent-switching-53
Open

fix: route chat to the selected agent instead of always MicroClaw (#53)#54
yikkuro wants to merge 1 commit into
mainfrom
yikkuro/fix-agent-switching-53

Conversation

@yikkuro

@yikkuro yikkuro commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #53.

Selecting a non-default agent (Coder, Van Gogh, etc.) still routed messages to the main (MicroClaw) persona, and both the top-left brand button and the in-chat message avatar reverted to MicroClaw.

Root causes

  • Session keys never encoded the agent, so every chat was normalised to agent:main server-side.
  • ensureEmptySession() kept an empty session bound to the previously selected agent instead of rebinding to the newly selected one.
  • The in-chat message avatar was hardcoded to normal.png (MicroClaw).

Changes

  • stores/chat.tsnewSession() now encodes non-default agents into the session key as agent:<id>:session-...; added an exported currentSessionAgentId computed.
  • components/SidePanel.vueensureEmptySession() starts/rebinds a session when the current chat has messages or belongs to a different agent, and always tags it with the current agent.
  • components/chat/ChatMessageList.vue — the in-chat avatar is now a computed that resolves the current session's agent avatar, falling back to the default.

Tests

Added 2 tests covering session-key encoding for default vs non-default agents. Full validation:

  • ✅ 141 renderer tests pass
  • vue-tsc typecheck clean
  • ✅ ESLint 0 errors

Manual verification

Verified live in the dev build: chatting with Van Gogh now shows Van Gogh in the header, the top-left brand button, and the in-chat avatar — and the painter persona responds (previously it reverted to MicroClaw).

Selecting a non-default agent (Coder, Van Gogh, etc.) still routed
messages to the main (MicroClaw) persona, and both the top-left brand
button and the in-chat avatar reverted to MicroClaw.

Root causes:
- Session keys never encoded the agent, so every chat was normalised to
  agent:main server-side.
- ensureEmptySession() kept an empty session bound to the previously
  selected agent instead of rebinding to the newly selected one.
- The in-chat message avatar was hardcoded to normal.png (MicroClaw).

Fixes:
- chat.ts: newSession() encodes non-default agents as
  `agent:<id>:session-...`; add exported currentSessionAgentId computed.
- SidePanel.vue: ensureEmptySession() starts/rebinds a session on agent
  mismatch and always tags it with the current agent.
- ChatMessageList.vue: in-chat avatar is now a computed resolving the
  current session's agent avatar, falling back to the default.

Adds 2 tests covering session-key encoding for default vs non-default
agents. Verified live via the dev build: chatting with Van Gogh now
shows Van Gogh in the header, brand button, and in-chat avatar, and the
painter persona responds.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Selecting a different agent on an empty chat routes the message to the previous/default agent (wrong persona)

1 participant